<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templates/template.xhtml">
        <h:head>
            <title>Seja bem-vindo ao ThreeDs!</title>
        </h:head>
        <ui:define name="content">
            <h:body>
                <h:form>
                    <center>
                        <!-- Painel -->
                       <p:panel id="panel" header="#{msgs.atributodetalhado}">  
                            <h:panelGrid columns="3">  
                                <h:outputLabel for="nome_atributo" value="#{msgs.nome}: *" />  
                                <p:inputText id="nome_atributo"  value="#{atributoMRBean.atributoMR.nome}" size="50" requiredMessage="#{msgs.campoobrigatorio}"
                                             required="true" label="Novo Projeto" />
                                <p:message for="nome_atributo" />  


                                <h:outputLabel for="dominio_atributo" value="#{msgs.dominio}: *"/>
                                <p:inputText id="dominio_atributo" 
                                             value="#{atributoMRBean.atributoMR.dominio}" size="50" 
                                             required="true" label="Categoria" requiredMessage="#{msgs.campoobrigatorio}">
                                </p:inputText> 
                                <p:message for="dominio_atributo" />  


                                <h:outputLabel for="descricao_atributo" value="#{msgs.descricao}: *"/>
                                <p:inputTextarea id ="descricao_atributo" rows="3" style="width: 423px" value="#{atributoMRBean.atributoMR.descricao}" 
                                                 required="true" label="Descrição" requiredMessage="#{msgs.campoobrigatorio}" >
                                </p:inputTextarea>
                                <p:message for="descricao_atributo" />  

                                <h:outputLabel for="limiteinferior" value="#{msgs.limiteinferior}: *" />  
                                <p:inputText id="limiteinferior"  value="#{atributoMRBean.atributoMR.limiteMin}" size="10" requiredMessage="#{msgs.campoobrigatorio}"
                                             required="true" label="Novo Projeto" />
                                <p:message for="limiteinferior" />  


                                <h:outputLabel for="limitesuperior" value="#{msgs.limitesuperior}: *"/>
                                <p:inputText id="limitesuperior" 
                                             value="#{atributoMRBean.atributoMR.limiteMin}" size="10" 
                                             required="true" label="Categoria" requiredMessage="#{msgs.campoobrigatorio}" >
                                </p:inputText> 

                              
                                
                                <h:selectOneMenu value="#{atributoMRBean.atributoMR.nulidade}" style="margin-left: -80px">
                                    <f:selectItem itemValue="#{msgs.nulo}" itemLabel="#{msgs.nulo}" />
                                    <f:selectItem itemValue="#{msgs.naonulo}" itemLabel="#{msgs.naonulo}"/>
                                </h:selectOneMenu>
                                

                                <h:outputLabel for="observacoes"  value="#{msgs.observacoes}: *"/>
                                <p:inputTextarea id ="observacoes" style="width: 423px" rows="3" value="#{atributoMRBean.atributoMR.observacao}" 
                                                 required="true" label="Descrição" requiredMessage="#{msgs.campoobrigatorio}">
                                </p:inputTextarea>

                                <br></br>
                                <h:outputLabel for="exemplo"  value="#{msgs.exemplo}: *"/>
                                <p:inputTextarea id ="exemplo" style="width: 423px" rows="3" 
                                                 value="#{atributoMRBean.atributoMR.exemplo}">    
                                </p:inputTextarea>
                                
                             
                            </h:panelGrid>  
                        </p:panel>             


                        <!-- Botões -->



                        <br>
                            <p:commandButton id="salvar" value="#{msgs.salvar}" actionListener="#{atributoMRBean.salvar()}" update="panel,resultado" 
                                             image="ui-icon ui-icon-disk" title="Salvar" process="@this,panel"/>


                        </br>

                        <br></br>
                        <!-- Tabela -->
                        <p:dataTable id="resultado" var="atributoMR" value="#{atributoMRBean.atributosMR}" 
                                     selection="#{atributoMRBean.atributoMR}" selectionMode="single" 
                                     update="panel">

                            <f:facet name="header">
                                #{msgs.resultados}
                            </f:facet>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.nome}"/>
                                </f:facet>
                                <h:outputText value="#{atributoMR.nome}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.dominio}"/>
                                </f:facet>
                                <h:outputText value="#{atributoMR.dominio}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.descricao}"/>
                                </f:facet>
                                <h:outputText value="#{atributoMR.descricao}"/>
                            </p:column>


                        </p:dataTable>


                    </center>
                </h:form>

            </h:body>
        </ui:define>

    </ui:composition>
</html>